package pri.hillchen.std.design.pattern.factory;

import pri.hillchen.std.design.pattern.factory.entry.BallPen;
import pri.hillchen.std.design.pattern.factory.entry.BrushPen;
import pri.hillchen.std.design.pattern.factory.entry.Pen;
import pri.hillchen.std.design.pattern.factory.entry.Pencil;

/**
 * Created by hillchen on 2018/3/5.
 */
public class SimplePenFactory {
    public Pen createPen(String penType){
        if ("pencil".equals(penType) ){
            return new Pencil();
        }else if("ballPen".equals(penType)){
            return new BallPen();
        } else if("brushPen".equals(penType)){
            return new BrushPen();
        }else {
            throw new RuntimeException(String.format("not found this type pen,penType:%s",penType));
        }
    }
}
